how to traverse characters in a string in a for loop in php

110

<?php
$str = "apple";
 
$length = strlen($str);
for ($index = 0; $index < $length; $index++) {
    echo $str[$index];
    echo "<br>";
}
?>

Comments

Submit
0 Comments